Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces two new public APIs (qaeMemMapContiguousIova and qaeMemUnmapContiguousIova) to enable zero-copy DMA operations by allowing users to map their pre-allocated memory buffers directly to IOVA addresses for QAT hardware access.
Key changes:
- Added
qaeMemMapContiguousIova()to allocate contiguous IOVA regions and map user-provided virtual memory for DMA operations - Added
qaeMemUnmapContiguousIova()to unmap and release previously mapped IOVA regions - Both APIs include proper error handling for no-IOMMU mode and unregistered VFIO containers
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| quickassist/utilities/libusdm_drv/user_space/vfio/qae_mem_utils_vfio.c | Implements the two new IOVA mapping/unmapping functions with validation checks and error handling |
| quickassist/utilities/libusdm_drv/qae_mem.h | Adds comprehensive API documentation for the new public functions including parameters, return values, and usage notes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
quickassist/utilities/libusdm_drv/user_space/vfio/qae_mem_utils_vfio.c
Outdated
Show resolved
Hide resolved
Contributor
Author
|
Adding @Wangl56. |
fionatrahe
reviewed
Jan 7, 2026
8482930 to
cb71853
Compare
gcabiddu
commented
Jan 8, 2026
Introduce two new public APIs to allow users to map their own
pre-allocated memory buffers to IOVA addresses for zero-copy DMA
operations:
- qaeMemMapContiguousIova(virt, size): Allocates a contiguous IOVA
region and maps user-provided virtual memory for DMA operations.
The IOVA is aligned to IOVA_SLAB_SIZE (2MB) internally. Maximum
supported size is 2GB. The mapping is registered in the USDM page
table, enabling qaeVirtToPhysNUMA() lookups on the mapped region.
Returns the IOVA address on success, 0 on failure.
- qaeMemUnmapContiguousIova(virt, size): Unmaps a previously mapped
IOVA region and releases the IOVA address space for reuse. The
IOVA is automatically looked up from the page table using the
provided virtual address.
These APIs enable users to avoid unnecessary memory copies when the QAT
DMA engine transfers data to/from user-allocated buffers. The user is
responsible for ensuring the virtual memory remains valid while the
IOVA mapping is active.
Note: These APIs are only available in VFIO mode and will fail if the
system is configured in no-IOMMU mode. Memory allocated through
qaeMemAllocNUMA() should not be mapped or unmapped using these APIs.
Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Contributor
Author
|
Merged internally. Will be part of QATlib 26.02. Closing. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduce two new public APIs to allow users to map their own pre-allocated memory buffers to IOVA addresses for zero-copy DMA operations:
qaeMemMapContiguousIova(): Allocates a contiguous IOVA region and maps user-provided virtual memory for DMA operations. Returns the IOVA address on success.
qaeMemUnmapContiguousIova(): Unmaps a previously mapped IOVA region and releases the IOVA address space for reuse.
These APIs enable users to avoid unnecessary memory copies when the QAT DMA engine transfers data to/from user-allocated buffers. The user is responsible for ensuring the virtual memory remains valid while the IOVA mapping is active.